package routers

import (
	admin "ginBasic/app/admin/controllers"
	"ginBasic/app/middleware"
	"github.com/gin-gonic/gin"
)

func AdminRoutersInit(r *gin.Engine) {
	//middlewares.InitMiddleWare中间件
	adminRouters := r.Group("/admin", middleware.InitAdminAuthMiddleware)
	{
		adminRouters.GET("/login", admin.LoginController{}.Index)
		adminRouters.GET("/captcha", admin.LoginController{}.Captcha)
		adminRouters.POST("/doLogin", admin.LoginController{}.DoLogin)
		adminRouters.GET("/loginOut", admin.LoginController{}.LoginOut)

		adminRouters.GET("/index", admin.IndexController{}.Index)
		adminRouters.GET("/main", admin.IndexController{}.Main)

		adminRouters.GET("/manager/index", admin.ManagerController{}.Index)
		adminRouters.GET("/manager/getlist", admin.ManagerController{}.GetList)
		adminRouters.GET("/manager/add", admin.ManagerController{}.Add)
		adminRouters.POST("/manager/doadd", admin.ManagerController{}.DoAdd)
		adminRouters.GET("/manager/edit", admin.ManagerController{}.Edit)
		adminRouters.POST("/manager/doedit", admin.ManagerController{}.DoEdit)
		adminRouters.GET("/manager/del", admin.ManagerController{}.Del)
		adminRouters.POST("/manager/status", admin.ManagerController{}.Status)

		adminRouters.GET("/role/index", admin.RoleController{}.Index)
		adminRouters.GET("/role/getlist", admin.RoleController{}.GetList)
		adminRouters.GET("/role/add", admin.RoleController{}.Add)
		adminRouters.POST("/role/doadd", admin.RoleController{}.DoAdd)
		adminRouters.GET("/role/edit", admin.RoleController{}.Edit)
		adminRouters.POST("/role/doedit", admin.RoleController{}.DoEdit)
		adminRouters.GET("/role/del", admin.RoleController{}.Del)
		adminRouters.POST("/role/status", admin.RoleController{}.Status)
		adminRouters.GET("/role/auth", admin.RoleController{}.Auth)
		adminRouters.POST("/role/doauth", admin.RoleController{}.DoAuth)

		adminRouters.GET("/access/index", admin.AccessController{}.Index)
		adminRouters.GET("/access/getlist", admin.AccessController{}.GetList)
		adminRouters.GET("/access/add", admin.AccessController{}.Add)
		adminRouters.POST("/access/doadd", admin.AccessController{}.DoAdd)
		adminRouters.GET("/access/edit", admin.AccessController{}.Edit)
		adminRouters.POST("/access/doedit", admin.AccessController{}.DoEdit)
		adminRouters.GET("/access/del", admin.AccessController{}.Del)

		adminRouters.GET("/config/index", admin.ConfigController{}.Index)
		adminRouters.POST("/config/update", admin.ConfigController{}.Update)

		adminRouters.GET("/test/index", admin.TestController{}.Index)
	}
}
